package com.oromwin.repos.server.request.file;

import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.server.request.Request;
import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;

public class ReadFileRequest implements Request {
    private Log log = Logger.getLog(ReadFileRequest.class);
    private String FileId = null;
    
    public ReadFileRequest(String fileId) {
        FileId = fileId;
    }

    public void send(DataOutputStream dos) throws ReposException {
        try {
            IOHelper.writeUTF8(dos, this.getClass().getName());
            IOHelper.writeUTF8(dos, FileId);
            dos.flush();
        } catch (IOException e) {
            throw ReposException.create(log, e, "Failed to write into output stream, {" + e.getMessage() + "}");
        }
    }
}
